function createRequest(){
	var request = null;
	try{
		request = new XMLHttpRequest();
	}catch(trymicrosoft){
		try{
			request = new ActiveXObject("Msxml2.XMLHTTP");
		}catch(othermicrosoft){
			try{
				request = new ActiveXObject("Microsoft.XMLHTTP");
			}catch(failed){
				request = null;
			}
		}
	}
	if(request == null){
		alert("Error creating request object!");
	}else{
		return request;
	}
}

var request1 = createRequest();
function getRecentMyTag(){
	var url = "/ilib/getMyTagClouds.do";
//	request1.open("POST", url, false);
	request1.open("GET", url, false);
	request1.onreadystatechange = updateTags;
//	request1.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
	request1.send(null);
}

function getRecentSysTag(){
	var url = "/ilib/getSysTagClouds.do";
	request1.open("GET", url, false);
	request1.onreadystatechange = updateTags;
	request1.send(null);
}

function updateTags(){
	if(request1.readyState == 4 && request1.status == 200){
		var response = eval('('+request1.responseText+')');
		if(response.list != null){
			for (var i = 0; i< response.list.length; i++){
				var tagName = response.list[i].tagName;
				var tagTimes = response.list[i].tagTimes;
				addTag(tagName, tagTimes);
			}
		}
		request1 = createRequest();
	}else
		alert("Error! request status is " + request1.status);
}

function addTag(tagName, tagTimes){
	var tag = document.getElementById("allTags");
	var font = document.createElement("font");
	font.size = tagTimes;
	font.id = "tagFont";
	tag.appendChild(font);
	var link = document.createElement("a");
	link.href = "/ilib/rscList.do?tagName=" + tagName;
//	link.style = "color: blue; text-decoration: none;";
	link.id = "tag";
	font.appendChild(link);
	link.appendChild(document.createTextNode(tagName));
}